/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package beans;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author machine
 */
@Entity
@Table(name = "series")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Series.findAll", query = "SELECT s FROM Series s"),
    @NamedQuery(name = "Series.findByIdseries", query = "SELECT s FROM Series s WHERE s.idseries = :idseries"),
    @NamedQuery(name = "Series.findByIdentificador", query = "SELECT s FROM Series s WHERE s.identificador = :identificador"),
    @NamedQuery(name = "Series.findByNombre", query = "SELECT s FROM Series s WHERE s.nombre = :nombre")})
public class Series implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idseries")
    private Integer idseries;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "identificador")
    private String identificador;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 150)
    @Column(name = "nombre")
    private String nombre;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idseries")
    private Collection<Seriespeliculas> seriespeliculasCollection;

    public Series() {
    }

    public Series(Integer idseries) {
        this.idseries = idseries;
    }

    public Series(Integer idseries, String identificador, String nombre) {
        this.idseries = idseries;
        this.identificador = identificador;
        this.nombre = nombre;
    }

    public Integer getIdseries() {
        return idseries;
    }

    public void setIdseries(Integer idseries) {
        this.idseries = idseries;
    }

    public String getIdentificador() {
        return identificador;
    }

    public void setIdentificador(String identificador) {
        this.identificador = identificador;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    @XmlTransient
    public Collection<Seriespeliculas> getSeriespeliculasCollection() {
        return seriespeliculasCollection;
    }

    public void setSeriespeliculasCollection(Collection<Seriespeliculas> seriespeliculasCollection) {
        this.seriespeliculasCollection = seriespeliculasCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idseries != null ? idseries.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Series)) {
            return false;
        }
        Series other = (Series) object;
        if ((this.idseries == null && other.idseries != null) || (this.idseries != null && !this.idseries.equals(other.idseries))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "beans.Series[ idseries=" + idseries + " ]";
    }
    
}
